public class Test1 {

    Solution solution = new Solution();
    public static void main(String[] args) {

        int[] nums = new int[]{1,4,0,2,3};
        System.out.println(Solution.missingNumber(nums));

    }
}
class Solution {
    public static int missingNumber(int[] nums) {

        int length = nums.length;


        boolean[] flgs = new boolean[length+1];
        for (int i = 0; i < length; i++) {

            flgs[nums[i]] = true;

        }
        for (int i = 0; i < length; i++) {
            if (!flgs[i]) {
                return i;
            }
        }
        return length;//对特殊情况的考量

    }
}
